import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { PersonInfo, PassWordx, ePersonalInfo } from "./types";

/**
 *  登录成功后获取用户信息（用户名，手机号码，所属部门，所属角色，创建日期）
 */
export function getpersonInfo(userId: number): AxiosPromise<PersonInfo> {
  return request({
    url: "/api/v1/system/users/" + userId + "/detail",
    method: "get",
  });
}

/**
 *  个人中心内修改密码
 */
export function ePassWordx(PassWordx: PassWordx): AxiosPromise<PassWordx> {
  return request({
    url: "/api/v1/auth/resetPwd",
    method: "post",
    params: PassWordx,
  });
}

/**
 *  个人中心修改个人信息
 */
export function epersonal(data: ePersonalInfo): AxiosPromise<string> {
  return request({
    url: "/api/v1/auth/changeUser",
    method: "post",
    data,
  });
}
